package com.exchange.View;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation.AnimationListener;
import android.widget.Button;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import com.exchange.Controller.ExchangeDataService;
import com.exchange.Controller.MoreClickListener;
import com.exchange.Controller.a;
import com.exchange.Public.ExchangeConstants;
import com.exchange.Public.h;
import com.exchange.View.a.a;
import com.exchange.View.a.b;
import com.exchange.View.a.d;
import com.exchange.a.a;
import com.exchange.a.b.a;
import com.exchange.a.c;
import com.exchange.b.a;
import java.util.ArrayList;
import java.util.List;

public class ag
  implements t.a
{
  Context a;
  ListView b;
  public View c;
  public View d;
  public ViewGroup e;
  public int f;
  public int g;
  public int h;
  public int i;
  public t j;
  public int k = -1;
  public Drawable l;
  public MoreClickListener m = null;
  public Animation.AnimationListener n;
  private ExchangeDataService o;
  private List<com.exchange.b.a> p;
  private Button q;

  public ag(Context paramContext, ViewGroup paramViewGroup, int paramInt, ExchangeDataService paramExchangeDataService)
  {
    this.a = paramContext;
    this.e = paramViewGroup;
    this.g = paramInt;
    if (h.d(this.a))
      this.i = ExchangeConstants.DRAWER_LIST_COUNT_VERTICAL;
    while (true)
    {
      this.o = paramExchangeDataService;
      a();
      a locala = new a(this);
      this.o.requestDataAsyn(this.a, locala);
      return;
      this.i = ExchangeConstants.DRAWER_LIST_COUNT_HORIZEN;
    }
  }

  private void a(Drawable paramDrawable, boolean paramBoolean)
  {
    this.q.setBackgroundDrawable(paramDrawable);
    if (!(paramBoolean))
    {
      this.j.e = paramDrawable;
      this.j.f = paramDrawable;
    }
    while (true)
    {
      while (true)
      {
        return;
        if (this.h != 1)
          break;
        this.j.e = this.a.getResources().getDrawable(d.i(this.a));
        this.j.f = this.a.getResources().getDrawable(d.a(this.a));
      }
      this.j.e = this.a.getResources().getDrawable(d.b(this.a));
      this.j.f = this.a.getResources().getDrawable(d.c(this.a));
    }
  }

  public RelativeLayout a(ViewGroup paramViewGroup)
  {
    RelativeLayout localRelativeLayout = new RelativeLayout(this.a);
    localRelativeLayout.setId(100);
    localRelativeLayout.setVisibility(8);
    localRelativeLayout.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
    localRelativeLayout.setBackgroundColor(Color.argb(200, 0, 0, 0));
    paramViewGroup.addView(localRelativeLayout);
    return localRelativeLayout;
  }

  public void a()
  {
    switch (this.g)
    {
    default:
    case 4:
    case 5:
    }
    while (true)
    {
      while (true)
      {
        return;
        this.h = 1;
        this.f = com.exchange.View.a.a.h(this.a);
      }
      this.h = 0;
      this.f = com.exchange.View.a.a.i(this.a);
    }
  }

  public void a(Drawable paramDrawable)
  {
    this.l = paramDrawable;
    if (this.j != null)
      a(this.l, false);
  }

  protected void a(ViewGroup paramViewGroup, int paramInt1, int paramInt2)
  {
    int i1;
    RelativeLayout.LayoutParams localLayoutParams1;
    int i3;
    if (paramInt2 == 0)
    {
      i1 = 10;
      this.j = new t(this.a, paramInt2, false, this.o);
      if (this.n != null)
        this.j.u.add(this.n);
      this.j.setId(0);
      localLayoutParams1 = new RelativeLayout.LayoutParams(-1, -2);
      localLayoutParams1.addRule(i1);
      this.j.a(this);
      this.j.a(new com.exchange.a.a(b.a.b, 1F, 1F));
      this.q = new Button(this.a);
      if (this.l == null)
        break label478;
      a(this.l, false);
      if (ExchangeConstants.handler_auto_expand)
        break label556;
      i3 = -2;
    }
    while (true)
    {
      RelativeLayout.LayoutParams localLayoutParams2 = new RelativeLayout.LayoutParams(i3, h.a(ExchangeConstants.TAG_HEIGHT, this.a));
      this.j.c = this.q;
      this.d = this.q;
      this.c = View.inflate(this.a, paramInt1, null);
      this.b = ((ListView)this.c.findViewById(com.exchange.View.a.b.x(this.a)));
      List localList = this.p;
      new ah(this.b, this.a, com.exchange.View.a.a.j(this.a), false, localList, this.g);
      this.c.setVisibility(8);
      this.j.d = this.c;
      RelativeLayout.LayoutParams localLayoutParams3 = new RelativeLayout.LayoutParams(-1, b());
      localLayoutParams3.addRule(i1);
      if (paramInt2 == 0)
      {
        this.j.addView(this.c, localLayoutParams3);
        this.j.addView(this.q, localLayoutParams2);
      }
      while (true)
      {
        label478: int i2;
        while (true)
        {
          this.j.g();
          RelativeLayout localRelativeLayout1 = new RelativeLayout(this.a);
          localRelativeLayout1.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
          localRelativeLayout1.setBackgroundColor(Color.alpha(0));
          if (ExchangeConstants.blur_switcher)
          {
            RelativeLayout localRelativeLayout2 = a(localRelativeLayout1);
            this.j.i = localRelativeLayout2;
          }
          localRelativeLayout1.addView(this.j, localLayoutParams1);
          paramViewGroup.addView(localRelativeLayout1);
          ((Button)this.c.findViewById(com.exchange.View.a.b.e(this.a))).setOnClickListener(new b(this));
          ((Button)this.c.findViewById(com.exchange.View.a.b.f(this.a))).setOnClickListener(new c(this));
          return;
          i1 = 12;
        }
        Resources localResources = this.a.getResources();
        if (paramInt2 == 0)
          i2 = d.c(this.a);
        while (true)
        {
          while (true)
            a(localResources.getDrawable(i2), true);
          i2 = d.a(this.a);
        }
        this.j.addView(this.q, localLayoutParams2);
        this.j.addView(this.c, localLayoutParams3);
      }
      label556: i3 = -1;
    }
  }

  public void a(t paramt)
  {
    if (paramt.getId() == 0)
      paramt.a(new com.exchange.a.a(b.a.b, 1F, 1F));
    while (true)
    {
      paramt.c.setVisibility(0);
      return;
      paramt.a(new com.exchange.a.c(b.a.b));
    }
  }

  public void a(t paramt, View paramView)
  {
    if (paramt.getId() == 0)
      paramt.a(new com.exchange.a.c(b.a.b));
    while (true)
    {
      paramt.c.setVisibility(0);
      paramt.f();
      new com.exchange.Controller.a(0, this.a, this.p.subList(0, this.i), this.g, 2, 0, this.o.displayStyle).start();
      return;
      paramt.a(new com.exchange.a.a(b.a.b, 1F, 1F));
    }
  }

  int b()
  {
    return h.a(50 + 57 * this.i, this.a);
  }
}